<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>

</body>
<script>
    var search = location.search;
    console.log(search);

    var str = search.substr(1);
    console.log(str);

    var arr = str.split("&");
    console.log(arr);

    for (var i = 0; i < arr.length; i++) {
        var item = arr[i];
        var subArr = item.split("=");
        console.log(subArr);
        arr[i] = subArr;

        var obj = {};
        var key = subArr[0]; //"user"
        var val = subArr[1];  //"123123"
        obj[key] = val; // 中括号中放字符串

        console.log(obj);
    }
    console.log(arr);

    var obj = {};// 对象的取值和赋值
    obj.name = 123123;  //1. 点一个属性名
    obj["age"] = 18;   // 2.  中括号中放置字符串
 

</script>

</html>